libxl: remove ctx->waitpid_instead
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 11 May 2012 17:59:02 +0000 (18:59 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Fri, 11 May 2012 17:59:02 +0000 (18:59 +0100)
Remove this obsolete hook.  Callers inside libxl which create and reap
children should use the mechanisms provided by the event system.

(This has no functional difference since there is no way for
ctx->waitpid_instead ever to become set.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
tools/libxl/libxl_exec.c
tools/libxl/libxl_internal.h

index b10e79f03d82e9b467370f08aa15fe0779b9d951..2ee2154e77813f01597f1fb1c0512331856eb1f5 100644 (file)
 
 #include "libxl_internal.h"
 
-static int call_waitpid(pid_t (*waitpid_cb)(pid_t, int *, int), pid_t pid, int *status, int options)
-{
-    return (waitpid_cb) ? waitpid_cb(pid, status, options) : waitpid(pid, status, options);
-}
-
 static void check_open_fds(const char *what)
 {
     const char *env_debug;
@@ -344,7 +339,7 @@ int libxl__spawn_spawn(libxl__gc *gc,
 
     if (!for_spawn) _exit(0); /* just detach then */
 
-    got = call_waitpid(ctx->waitpid_instead, child, &status, 0);
+    got = waitpid(child, &status, 0);
     assert(got == child);
 
     rc = (WIFEXITED(status) ? WEXITSTATUS(status) :
@@ -404,7 +399,7 @@ int libxl__spawn_detach(libxl__gc *gc,
                          (unsigned long)for_spawn->intermediate);
             abort(); /* things are very wrong */
         }
-        got = call_waitpid(ctx->waitpid_instead, for_spawn->intermediate, &status, 0);
+        got = waitpid(for_spawn->intermediate, &status, 0);
         assert(got == for_spawn->intermediate);
         if (!(WIFSIGNALED(status) && WTERMSIG(status) == SIGKILL)) {
             report_spawn_intermediate_status(gc, for_spawn, status);
@@ -421,14 +416,13 @@ int libxl__spawn_detach(libxl__gc *gc,
 
 int libxl__spawn_check(libxl__gc *gc, libxl__spawn_starting *for_spawn)
 {
-    libxl_ctx *ctx = libxl__gc_owner(gc);
     pid_t got;
     int status;
 
     if (!for_spawn) return 0;
 
     assert(for_spawn->intermediate);
-    got = call_waitpid(ctx->waitpid_instead, for_spawn->intermediate, &status, WNOHANG);
+    got = waitpid(for_spawn->intermediate, &status, WNOHANG);
     if (!got) return 0;
 
     assert(got == for_spawn->intermediate);
index 21fe99c839e20021880046e3c378cd183397e61d..6fb99f6660b43a4e211043a31a0123a11a2ef0cf 100644 (file)
@@ -325,9 +325,6 @@ struct libxl__ctx {
     int sigchld_selfpipe[2]; /* [0]==-1 means handler not installed */
     LIBXL_LIST_HEAD(, libxl__ev_child) children;
 
-    /* This is obsolete and must be removed: */
-    int (*waitpid_instead)(pid_t pid, int *status, int flags);
-
     libxl_version_info version_info;
 };